package 力扣._00周赛._369周赛.问题1;

public class Solution {
    public int findKOr(int[] nums, int k) {
        int[] sum = new int[32];
        for (int num : nums) {
            int i = 31;
            while (num > 0) {
                sum[i--] += num % 2;
                num /= 2;
            }
        }
        for (int i = 0; i < sum.length; i++) {
            if (sum[i] < k)
                sum[i] = 0;
            else
                sum[i] = 1;
        }
        int r = 0;
        for (int j : sum) {
            r = r * 2 + j;
        }
        return r;

    }
}
